// express_helloworld.js
var express = require('express');
var bodyParser = require('body-parser');
var multer = require('multer'); //multer
var app = express();

const moment = require('moment');

app.use(bodyParser.json());
app.use(bodyParser.urlencoded({extended: true}));
// app.use(multer());

// app.use(bodyParser.json()); // for parsing application/json
// app.use(bodyParser.urlencoded({ extended: true })); // for parsing application/x-www-form-urlencoded
// app.use(multer()); // for parsing multipart/form-data

const obj = {};
const rs = {};
obj['RESPONSE'] = rs;
rs['RETURN_CODE'] = 'S000A888';
rs['RETURN_DESC'] = '成功Success';
rs['RETURN_STAMP'] = null;
rs['RETURN_DATA'] = '业务数据888';
rs['Sign'] = '业务数据008';


app.all('/', function(req, res){
	console.log( req.body );
	
	rs['RETURN_STAMP'] = moment().format('YYYY-MM-DD HH:mm:ss:SSS');
	res.send( JSON.stringify(obj) );
});

var server = app.listen(3000, function () {
  var host = server.address().address;
  var port = server.address().port;

  console.log('Example app listening at http://%s:%s', host, port);
});


